package com.cty.avltree;


public class AVLTreeDemo {
    public static void main(String[] args) {
        int[] arr = {10,11,7,6,8,9};
        AVLTree avlTree = new AVLTree();
        for (int i = 0; i < arr.length; i++) {
            avlTree.add(new Node(arr[i]));
        }
        avlTree.midOrder();
        System.out.println("树的高度 = " + avlTree.height());
        System.out.println("左子树的高度 = " + avlTree.getRoot().leftHeight());
        System.out.println("右子树的高度 = " + avlTree.getRoot().rightHeight());
        System.out.println("根结点" + avlTree.getRoot());
        System.out.println("根节点的左节点" + avlTree.getRoot().left);
        System.out.println("根节点的左子树的左结点" + avlTree.getRoot().left.left);
        System.out.println("根节点的右结点" + avlTree.getRoot().right);
        System.out.println("根节点的右子树的左结点" + avlTree.getRoot().right.left);
        System.out.println("根节点的右子树的右结点" + avlTree.getRoot().right.right);
    }
}
